/**
 * 作用:给object对象定义类型
 * 语法:变量名:{属性名1:Type1;属性名2:Type2...}
 */

// let obj: { name: string; age: number; study?: () => void }

// obj = {
//     name:'李鑫宇',
//     age:18
// }

// obj.study()

type ObjType = { name: string; age: number; study?: () => void }
let obj: ObjType


type StuType = {
    name: string
    age: number
    height?: number
    work: (money: number) => number
    study: () => void
    game?: () => void
    [key: string]: any // 索引签名,可选属性的扩展,可以统一制定多出来的属性和值
}

let student: StuType = {
    name: '杨波',
    age: 20,
    work(money) {
        return money
    },
    study() {

    },
    a: 1,
    b: true
}

student.work(1e8)